package com.atguigu.scala.chapter6
/**
 * @author lizikuan
 * @date 2021/5/21 20:42
 */

object $04_ClassAndObject {
    object Student{
      private val name = "zhangsan"
      def getAge:Int = new Student().age
      def apply(): Student = new Student()
    }

    class Student{
      private val age = 20
      var address = "zhongguo"
      def getName:String =  Student.name
    }

  def main(args: Array[String]): Unit = {
    val student = Student.apply()
    println(student.address)
    println(Student().getName)
    println(new Student().getName)
    println(Student.getAge)
  }
}
